@echo off
echo ==========================================
echo Redis COM Component Installation Script
echo ==========================================
echo.

echo [1/4] Checking Python environment...
python --version
if errorlevel 1 (
    echo ERROR: Python not found. Please install Python 3.6+ first.
    pause
    exit /b 1
)

echo.
echo [2/4] Installing required Python packages...
pip install pywin32 redis
if errorlevel 1 (
    echo ERROR: Failed to install required packages.
    pause
    exit /b 1
)

echo.
echo [3/4] Registering Redis COM component...
python redis_com_server.py
if errorlevel 1 (
    echo ERROR: Failed to register COM component.
    pause
    exit /b 1
)

echo.
echo [4/4] Testing COM component...
python redis_com_server.py --test
if errorlevel 1 (
    echo WARNING: COM component test failed. Please check Redis connection.
)

echo.
echo ==========================================
echo Installation completed successfully!
echo ==========================================
echo.
echo Next steps:
echo 1. Ensure Redis server is running
echo 2. Update Redis connection settings in redis_com_server.py if needed
echo 3. Test the demo page: test_redis_demo.asp
echo.
echo For support, see README.md
echo.
pause
